
function throttle(fn, time) {
let isThrottle = false,
    savrThis,
    savedArgs
    function wrapper() {
        if(isThrottle) {
        savedArgs = arguments
        savrThis = this
        return
        }
        fn.apply(this, arguments)
        isThrottle = true

        setTimeout(() => {
        isThrottle = false
        if(savedArgs) {
            wrapper.apply(savrThis,savedArgs)
            savrThis = savedArgs = null
        }
        }, time)
    }
    return wrapper
}